Open
Conversation
added 20 commits
January 23, 2016 09:41
Implemented hasEdgesBetween which gives boolean value according to the presence of edge. Also implemented addVertex which add the vertex and addEdge which creates edge between two vertices as a part of implementing the basic graph.
Implemented order method which gives the order of the graph. It is the number of vertices in the graph.
Implemented size method which gives the size of the graph. It is basically the number of edges in the graph.
Implemented pathBetween which returns a path between the given vertices. There is no guarantee that the shortest or farthest will be returned.
Implemented farthestVertex which returns the farthest vertex from a given vertex.
Implemented undirectedGraph which has all methods as directed graph with a little changes in the methods.
Implemented allPaths which gives all the paths between two given vertices. It is working with dense graph also. But may need further optimisation.
Implemented all the methods that directed graph has to undirected graph. All tests are passing.
Instead of repeating the prototype twice for each undirected and directed graph, now i have created a graph object which has the methods that are common for directed and undirected graphs. The additional methods are added to the constructors seperately.
The size method in both directed and undirected graphs were similar except one of them was returning the half of the caluculated value. To avoid the repeatation of code twice, created numberOfEdges method in graph and edited size method in directed and undirected graphs.
Implemented a simple shortestPath method in weightedGraph which gives the shortest path between 2 given vertices in weightedGraph. Also Implemented some necessary objects such as edge for the weightedGraph.
Modified and refactored shortestPath of weightedGraph to work with the graphs having loops. A new test of dense graph is added to prove the working of shortestPath on very complicated dense graph.
Modified dense graph test a little. All tests are passing.
Instead of altering the array by adding a key called pathLength inside the array, now it is using a object called Path. Path is a simple object which has a path and length of tha path. It can be further developed as per requirement.
Implemented and tested the shortestPath method of weightedGraph using Digestra's algorithm. Added more tests to check the working of algorithm with dense, complex and multi graphs.
Refactored the weightedGraph object for common names such as edge, weigth etc.
Instead of having basic graph in graphs module, now it is in differnt module which can be required by other modules to use basic graph.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.